import type { FC } from 'react';
import MapView, { type MapViewProps } from './mapView';
import SearchBar from './search'
import type { Address } from '../index'

export type MapControlProps = Omit<MapViewProps, 'children'> & {
  defaultValue?: Address;
};

const MapControl: FC<MapControlProps> = (props) => {
  return (
    <MapView onOk={props.onOk}>
      {control => (
        <SearchBar
          control={control}
          defaultValue={props.defaultValue}
        />
      )}
    </MapView>
  );
}

export default MapControl;